//{ "allowMappedTypes": "in-intersections" }
type Foo1<T> = { readonly [P in keyof T]: T[P] };

type Foo2<T> = { [P in keyof T]?: T[P] };

type Foo3<T, U> =
  | { readonly [P in keyof T]: T[P] }
  | { readonly [P in keyof U]: U[P] };

type Foo4<T, U> = { [P in keyof T]?: T[P] } | { [P in keyof U]?: U[P] };

type Foo5<T> = {
  readonly [P in keyof T]: T[P];
};

type Foo6<T> =
  | {
  readonly [P in keyof T]: T[P];
}
  | {
  readonly [P in keyof T]: T[P];
};